﻿/*
 * Copyright (c) Seagull Consulting, Inc. All rights reserved. See License.txt in the project root for license information.
 */
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using SeagullConsulting.MvcAjaxControls.Data.Models;

namespace SeagullConsulting.MvcAjaxControls.Data.Repository
{
    public class CityRepository
    {
        IList<City> cities;

        public CityRepository()
        {
            cities = new List<City>() {
                new City() { Id = 1, StateId = 1, Name = "Tampa"},
                new City() { Id = 2, StateId = 1, Name = "Brandon"},
                new City() { Id = 3, StateId = 2, Name = "Alanta"},
                new City() { Id = 4, StateId = 2, Name = "Marietta"},
                new City() { Id = 5, StateId = 3, Name = "Ottawa"},
                new City() { Id = 6, StateId = 3, Name = "Toronto"},
                new City() { Id = 7, StateId = 4, Name = "Quebec City"},
                new City() { Id = 8, StateId = 4, Name = "Montreal"},

            };
        }

        public IQueryable<City> List()
        {
            return cities.OrderBy(c => c.Name).AsQueryable();
        }

        public IQueryable<City> List(int stateId)
        {
            return cities.Where(s => s.StateId == stateId).OrderBy(c => c.Name).AsQueryable();
        }

    }
}